import request from '@/utils/request'

// 查询库位信息列表
export function listLocation(query) {
  return request({
    url: '/wms/base/location/list',
    method: 'get',
    params: query
  })
}

// 查询库位信息详细
export function getLocation(locationId) {
  return request({
    url: '/wms/base/location/' + locationId,
    method: 'get'
  })
}

// 根据库区ID查询库位列表
export function listLocationByAreaId(areaId) {
  return request({
    url: '/wms/base/location/listByAreaId/' + areaId,
    method: 'get'
  })
}

// 新增库位信息
export function addLocation(data) {
  return request({
    url: '/wms/base/location',
    method: 'post',
    data: data
  })
}

// 修改库位信息
export function updateLocation(data) {
  return request({
    url: '/wms/base/location',
    method: 'put',
    data: data
  })
}

// 删除库位信息
export function delLocation(locationId) {
  return request({
    url: '/wms/base/location/' + locationId,
    method: 'delete'
  })
}

// 导出库位信息
export function exportLocation(query) {
  return request({
    url: '/wms/base/location/export',
    method: 'post',
    params: query,
    responseType: 'blob'  // 指定响应类型为二进制数据
  })
}
